FROM swr.cn-north-4.myhuaweicloud.com/opensourceway/openeuler/nginx-hugo:latest

COPY . /src/website/

RUN cd /src/website/ \
    && hugo -b / --minify \
    && cp -r /src/website/public/* /usr/share/nginx/html/ \
    && chown nginx:nginx -R /usr/share/nginx/html

COPY ./deploy/nginx.conf /etc/nginx/nginx.conf

RUN touch /var/run/nginx.pid \
    && chown -R nginx:nginx /var/log/nginx \
    && chown -R nginx:nginx /var/run/nginx.pid \
    && chown -R nginx:nginx /etc/nginx

EXPOSE 8080

USER nginx

ENTRYPOINT ["nginx", "-g", "daemon off;"]
